<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<c:choose>
    <c:when test="${presentationMedium == 'desktop'}">
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhmtl1-transitional.dtd">
    </c:when>
    <c:when test="${presentationMedium == 'mobile'}">
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN"
            "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">
        </c:when>
</c:choose>

<html>
    <head>
        <meta name="author" content="Guy Sagy" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link href="resources/company_icon_32x32.ico" rel="shortcut icon" type="image/ico" />
        <link href="css/${presentationMedium}/main.css" rel="stylesheet" type="text/css" />
        <link href="css/${presentationMedium}/menubar.css" rel="stylesheet" type="text/css" />
        <link href="css/${presentationMedium}/formlayout.css" rel="stylesheet" type="text/css" />
        <script src="js/3rdpartylibs/jslib_dom_ready.js" type="text/javascript"></script>
        <script src="js/3rdpartylibs/jslib_css.js" type="text/javascript"></script>
        <script src="js/3rdpartylibs/jslib_event.js" type="text/javascript"></script>
        <script src="js/3rdpartylibs/jslib_event_mouse.js" type="text/javascript"></script>
        <script src="js/3rdpartylibs/jslib_event_keyboard.js" type="text/javascript"></script>
        <script src="js/button_handlers.js" type="text/javascript"></script>
        <script src="js/data_validation.js" type="text/javascript"></script>
        <script src="js/menubar.js" type="text/javascript"></script>
        <script src="js/3rdpartylibs/jquery-1.6.1.js" type="text/javascript"></script>
        <script src="js/feedback.js" type="text/javascript"></script>
        <title>${appTitle} - ${pageTitle}</title>

        <c:if test="${presentationMedium == 'mobile'}">
            <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
        </c:if>

    </head>
    <body>

        <c:if test="${presentationMedium == 'desktop'}">
                <!-- body header section -->
                <div id="captionBar">
                    <h1>${appTitle} - Welcome ${user.profile.firstName} ${user.profile.lastName}</h1>
                </div>

                <%@ include file="WEB-INF/jspf/new_mainmenu.jspf" %>
        </c:if>

        <c:choose>
            <c:when test="${presentationMedium == 'desktop' && mode == 'post'}">
                <div class="formLayout">
                    <form action=<%= response.encodeURL("Feedback") %> method="post" >
                        <input type="hidden" name="mode" value="submit"/>
                        <label for="dummy"><h1>Feedback:</h1></label>
                        <input type="hidden" name="dummy" id="dummy"/>
                        <br/>
                        <label for="subject">Title</label>
                        <input type="text" name="subject" id="subject"/>
                        <br/>
                        <label for="text">Feedback</label>
                        <textarea name="text" id="text" rows="5" cols="20"></textarea>
                        <br/>
                        <!--
                        <label for="signature">Your email</label>
                        <input type="text" name="signature" id="signature"/>
                        <br/>
                        -->
                        <label for="submitButton">&nbsp;</label>
                        <button name="submitButton" type="submit">Submit</button>
                        <br/>
                        <label for="resetButton">&nbsp;</label>
                        <button name="resetButton" type="reset">Discard</button>
                        <br/>
                    </form>
                </div>
            </c:when>
            <c:when test="${presentationMedium == 'mobile' && mode == 'post'}">
                <div id="post">
                    <form action=<%= response.encodeURL("Feedback") %> method="post">
                        <input type="hidden" name="mode" value="submit"/>
                        <input type="hidden" name="emailAddress" id ="emailAddress" value="${emailAddress}"/>
                        <h1 class="webkit">Post your feedback</h1>
                        <ul>
                            <li><input type="text" name="subject" id="subject" placeholder="Feedback title"/></li>
                            <li><textarea name="text" id="text" placeholder="Feedback details" rows="5" cols="20"></textarea></li>
                            <!--<li><input type="text" name="email" id="email" placeholder="Your email"/></li>-->
                            <li class="naked"><button type="submit">Submit</button></li>
                            <li class="naked"><button type="reset">Discard</button></li>
                        </ul>
                    </form>
                </div>
            </c:when>
            <c:when test="${mode == 'read'}">
                <div id="posts" class="postsTable">
                    <h1>Your posts:</h1>
                    ${postsSubjects}
                </div>
            </c:when>
            <c:otherwise>
                <div>
                    <h1>Ooops! How embaracing. An unexpected page error has occured ...</h1>
                </div>
            </c:otherwise>
        </c:choose>

        <!-- body footer section -->
        <%@include file="WEB-INF/jspf/footer.jspf" %>

    </body>
</html>
